/**
 * 任务列表
 */
export default  class TaskEntity {

    constructor(id,name, type, constraints, status,processes) {
        this.id=id;
        this.name = name;
        this.type = type;
        this.processes=processes;
        this.setStatus(status);
    }

    setProcesses(processes) {
        this.processes = processes;
    }
    setStatus(status) {
        const validStatus = ['In Progress', 'Completed', 'Pending'];
        if (!validStatus.includes(status)) {
            throw new Error("Invalid status.");
        }
        this.status = status;
    }

    updateStatus(newStatus) {
        this.setStatus(newStatus);
        console.log(`The status of ${this.name} is now ${newStatus}.`);
    }
}
